
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.4uniapp之uts语言 · uniapp/uniapp-x for Harmony教程</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="坚果派">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mind-maps/mindmaps.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-lou/lou.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="4.uniapp for Harmony.html" />
    
    
    <link rel="prev" href="1.uniapp开发鸿蒙应用.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"};
    </script>

    </head>
    <body>
         
<div class="donate-modal modal">
  <div class="modal-header">
    <div>
      <span>
        <img
          id="modal-avatar"
          class="modal-avatar"
          src="http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"
        />
      </span>
      <span id="nickname"> breeze </span>
      <p class="modal-close close" onclick="closeDonateModal()">×</p>
    </div>
    <div class="message">
      <div class="tip">
        <i></i>
        <span>随意打赏，但不要超过一顿早餐钱 💕</span>
      </div>
    </div>
  </div>
  <div class="modal-content">
    <div class="modal-pay-way">
      <div id="wxpay" onclick="showDonateImg(0)">
        <input
          type="radio"
          name="pay-way"
          value="wxpay"
          class="zs-type"
          checked="checked"
        />
        <span>
          <img
            id="wxpay-logo"
            src=""
          />
        </span>
      </div>
      <div id="alipay" onclick="showDonateImg(1)">
        <input type="radio" name="pay-way" value="alipay" class="zs-type" />
        <span>
          <img
            id="alipay-logo"
            src=""
          />
        </span>
      </div>
    </div>
    <div class="modal-pay-qrcode">
      <img id="wxpay-code" src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png" />
      <img
        id="alipay-code"
        src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png"
        hidden
      />
    </div>
  </div>
</div>
<div class="mask"></div>


<div class="book">
  <div class="header-inner">
    <!-- LOGO -->
    <div class="logo"></div>
    <span class="title"></span>

    <!-- Search -->
    
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>


    <!-- Nav -->
    <ul class="header-nav">
      <li>
        <a href="https://www.nutpi.net/" target="_blank">坚果派官网</a>
      </li><li>
        <a href="https://www.arkui.club/" target="_blank">ArkUI实战</a>
      </li><li>
        <a href="https://space.bilibili.com/480883651" target="_blank">元服务开发实践</a>
      </li><li>
        <a href="https://gitcode.com/nutpi" target="_blank">OpenHarmony应用开发</a>
      </li>
    </ul>
  </div>

  <div class="book-summary">
    <div class="book-summary-title">文档目录</div>
     
    <nav role="navigation">


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    1.前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter2/1.为什么.html">
            
                <a href="../chapter2/1.为什么.html">
            
                    
                    2.为什么要这个专栏？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    3.uniapp开发鸿蒙
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="14.背景.md">
            
                <span>
            
                    
                    3.1背景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="15.优势.html">
            
                <a href="15.优势.html">
            
                    
                    3.2优势
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="1.uniapp开发鸿蒙应用.html">
            
                <a href="1.uniapp开发鸿蒙应用.html">
            
                    
                    3.3uniapp开发鸿蒙应用
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.4" data-path="3.uniapp之uts语言.html">
            
                <a href="3.uniapp之uts语言.html">
            
                    
                    3.4uniapp之uts语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="4.uniapp for Harmony.html">
            
                <a href="4.uniapp for Harmony.html">
            
                    
                    3.5uniapp for Harmony
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="5.uniapp for Harmony FAQ.html">
            
                <a href="5.uniapp for Harmony FAQ.html">
            
                    
                    3.6uniapp for Harmony FAQ
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="2.uniapp2.html">
            
                <a href="2.uniapp2.html">
            
                    
                    3.7uniapp2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="6.uniappx支持鸿蒙.html">
            
                <a href="6.uniappx支持鸿蒙.html">
            
                    
                    3.8uniappx支持鸿蒙
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="7.uniapp-x支持鸿蒙.html">
            
                <a href="7.uniapp-x支持鸿蒙.html">
            
                    
                    3.9uniapp-x支持鸿蒙
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="8.目前支持鸿蒙手机.html">
            
                <a href="8.目前支持鸿蒙手机.html">
            
                    
                    3.10目前支持鸿蒙手机
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="9.uniapp-x项目开发鸿蒙支持调试啦.html">
            
                <a href="9.uniapp-x项目开发鸿蒙支持调试啦.html">
            
                    
                    3.11uniapp-x项目开发鸿蒙支持调试啦
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="10.uniapp和flutter你会选哪个来开发鸿蒙.html">
            
                <a href="10.uniapp和flutter你会选哪个来开发鸿蒙.html">
            
                    
                    3.12uniapp和flutter你会选哪个来开发鸿蒙
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="11.Flutter与uni-app的深度对比：鸿蒙开发的最佳选择竟是原生开发.md.md">
            
                <span>
            
                    
                    3.13Flutter与uni-app的深度对比：鸿蒙开发的最佳选择竟是原生开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="12.uniapp版本更新.html">
            
                <a href="12.uniapp版本更新.html">
            
                    
                    3.14uniapp版本更新
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="13.HBuilderX 4.62 开始，uni-app 支持嵌入鸿蒙原生组件.html">
            
                <a href="13.HBuilderX 4.62 开始，uni-app 支持嵌入鸿蒙原生组件.html">
            
                    
                    3.15HBuilderX 4.62开始，uni-app支持嵌入鸿蒙原生组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="16.uni-app x 已经完成鸿蒙等主流平台全覆盖.html">
            
                <a href="16.uni-app x 已经完成鸿蒙等主流平台全覆盖.html">
            
                    
                    3.16uni-app x 已经完成鸿蒙等主流平台全覆盖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="17.uniapp如何进行条件编译到鸿蒙.html">
            
                <a href="17.uniapp如何进行条件编译到鸿蒙.html">
            
                    
                    3.17uniapp如何进行条件编译到鸿蒙
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="18.鸿蒙Next案例分析.html">
            
                <a href="18.鸿蒙Next案例分析.html">
            
                    
                    3.18鸿蒙Next案例分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="19.UTS开发鸿蒙插件.md">
            
                <span>
            
                    
                    3.19UTS开发鸿蒙插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="20.热重载.html">
            
                <a href="20.热重载.html">
            
                    
                    3.20热重载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="21.调用鸿蒙原生组件.html">
            
                <a href="21.调用鸿蒙原生组件.html">
            
                    
                    3.21调用鸿蒙原生组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="22.从开发者视角看 uniapp 与 Flutter 的差异.html">
            
                <a href="22.从开发者视角看 uniapp 与 Flutter 的差异.html">
            
                    
                    3.22从开发者视角看 uniapp 与 Flutter 的差异
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="23.uniappforHarmony学习路线.html">
            
                <a href="23.uniappforHarmony学习路线.html">
            
                    
                    3.23uniappforHarmony学习路线
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    4.随机笑话-实战案例
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter4/1.uni-app_x跨平台实战入门：从0到1开发HarmonyOS_5鸿蒙原生应用.html">
            
                <a href="../chapter4/1.uni-app_x跨平台实战入门：从0到1开发HarmonyOS_5鸿蒙原生应用.html">
            
                    
                    4.1 uni-app x 跨平台实战入门：从 0 到 1 开发 HarmonyOS 5 鸿蒙原生应用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    5.二十四节气
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    5.1二十四节气实战案例
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    6.UTS插件开发
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter6/1.UTS开发鸿蒙插件.html">
            
                <a href="../chapter6/1.UTS开发鸿蒙插件.html">
            
                    
                    6.1 UTS开发鸿蒙插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter6/2.开发uts插件.html">
            
                <a href="../chapter6/2.开发uts插件.html">
            
                    
                    6.2 开发uts插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter6/3.新建鸿蒙插件.html">
            
                <a href="../chapter6/3.新建鸿蒙插件.html">
            
                    
                    6.3 新建鸿蒙插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../chapter6/4.鸿蒙使用插件.md">
            
                <span>
            
                    
                    6.4 鸿蒙使用插件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    7.鸿蒙插件实战
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../chapter7/1.开发鸿蒙插件.html">
            
                <a href="../chapter7/1.开发鸿蒙插件.html">
            
                    
                    7.1 开发鸿蒙插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../chapter7/2.uniappx插件nutpi-idcard 开发与使用指南（适配鸿蒙）.html">
            
                <a href="../chapter7/2.uniappx插件nutpi-idcard 开发与使用指南（适配鸿蒙）.html">
            
                    
                    7.2 uniappx插件nutpi-idcard开发与使用指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../chapter7/3.chinese-number-format插件.html">
            
                <a href="../chapter7/3.chinese-number-format插件.html">
            
                    
                    7.3 chinese-number-format插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../chapter7/4.calendar插件.html">
            
                <a href="../chapter7/4.calendar插件.html">
            
                    
                    7.4 calendar插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../chapter7/5.HBuilderX 中适配鸿蒙插件的安装使用指南.html">
            
                <a href="../chapter7/5.HBuilderX 中适配鸿蒙插件的安装使用指南.html">
            
                    
                    7.5 HBuilderX中适配鸿蒙插件的安装使用指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../chapter7/OpenHarmony5.0跟华为HarmonyOS之间的应用生态兼容情况.html">
            
                <a href="../chapter7/OpenHarmony5.0跟华为HarmonyOS之间的应用生态兼容情况.html">
            
                    
                    7.6 OpenHarmony与HarmonyOS兼容性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>

</nav>
     
  </div>

  <!-- Content nav -->
  <div class="book-anchor">
    <div class="book-anchor-title"></div>

    <div class="book-anchor-body"></div>
  </div>

  <div class="book-body">
    
    <div class="body-inner">
       

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >3.4uniapp之uts语言</a>
    </h1>
</div>



      <div class="page-wrapper" tabindex="-1" role="main">
        <div class="page-inner">
          
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
          <section class="normal markdown-section">
             
                <div id="vip-container">
                    <h2 id="uts-&#x662F;&#x4EC0;&#x4E48;"><a name="uts-&#x662F;&#x4EC0;&#x4E48;" class="plugin-anchor" href="#uts-&#x662F;&#x4EC0;&#x4E48;"><i class="fa fa-link" aria-hidden="true"></i></a>uts &#x662F;&#x4EC0;&#x4E48;</h2>
<p>uts&#xFF0C;&#x5168;&#x79F0; uni type script&#xFF0C;&#x662F;&#x4E00;&#x95E8;&#x8DE8;&#x5E73;&#x53F0;&#x7684;&#x3001;&#x9AD8;&#x6027;&#x80FD;&#x7684;&#x3001;&#x5F3A;&#x7C7B;&#x578B;&#x7684;&#x73B0;&#x4EE3;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x3002;</p>
<p>&#x5B83;&#x53EF;&#x4EE5;&#x88AB;&#x7F16;&#x8BD1;&#x4E3A;&#x4E0D;&#x540C;&#x5E73;&#x53F0;&#x7684;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#xFF0C;&#x5982;&#xFF1A;</p>
<ul>
<li>web&#x5E73;&#x53F0;/&#x5C0F;&#x7A0B;&#x5E8F;&#xFF0C;&#x7F16;&#x8BD1;&#x4E3A;JavaScript</li>
<li>Android&#x5E73;&#x53F0;&#xFF0C;&#x7F16;&#x8BD1;&#x4E3A;Kotlin</li>
<li>iOS&#x5E73;&#x53F0;&#xFF0C;&#x7F16;&#x8BD1;Swift</li>
<li>&#x9E3F;&#x8499;OS&#x5E73;&#x53F0;&#xFF0C;&#x7F16;&#x8BD1;&#x4E3A;ArkTS&#xFF08;HBuilderX 4.22+&#xFF09;</li>
</ul>
<p>uts &#x91C7;&#x7528;&#x4E86;&#x4E0E; ts &#x57FA;&#x672C;&#x4E00;&#x81F4;&#x7684;&#x8BED;&#x6CD5;&#x89C4;&#x8303;&#xFF0C;&#x652F;&#x6301;&#x7EDD;&#x5927;&#x90E8;&#x5206; ES6 API&#x3002;</p>
<p>&#x4F46;&#x4E3A;&#x4E86;&#x8DE8;&#x7AEF;&#xFF0C;uts&#x8FDB;&#x884C;&#x4E86;&#x4E00;&#x4E9B;&#x7EA6;&#x675F;&#x548C;&#x7279;&#x5B9A;&#x5E73;&#x53F0;&#x7684;&#x589E;&#x8865;&#x3002;</p>
<p>&#x8FC7;&#x53BB;&#x5728;js&#x5F15;&#x64CE;&#x4E0B;&#x8FD0;&#x884C;&#x652F;&#x6301;&#x7684;&#x8BED;&#x6CD5;&#xFF0C;&#x5927;&#x90E8;&#x5206;&#x5728;uts&#x7684;&#x5904;&#x7406;&#x4E0B;&#x4E5F;&#x53EF;&#x4EE5;&#x5E73;&#x6ED1;&#x7684;&#x5728;kotlin&#x548C;swift&#x4E2D;&#x4F7F;&#x7528;&#x3002;&#x4F46;&#x6709;&#x4E00;&#x4E9B;&#x65E0;&#x6CD5;&#x62B9;&#x5E73;&#xFF0C;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x6761;&#x4EF6;&#x7F16;&#x8BD1;&#x3002;</p>
<p>&#x548C;uni-app&#x7684;&#x6761;&#x4EF6;&#x7F16;&#x8BD1;&#x7C7B;&#x4F3C;&#xFF0C;uts&#x4E5F;&#x652F;&#x6301;&#x6761;&#x4EF6;&#x7F16;&#x8BD1;&#x3002;&#x5199;&#x5728;&#x6761;&#x4EF6;&#x7F16;&#x8BD1;&#x91CC;&#x7684;&#xFF0C;&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x5E73;&#x53F0;&#x7279;&#x6709;&#x7684;&#x6269;&#x5C55;&#x8BED;&#x6CD5;&#x3002;</p>
<h3 id="&#x7528;&#x9014;&#x548C;&#x5173;&#x7CFB;"><a name="&#x7528;&#x9014;&#x548C;&#x5173;&#x7CFB;" class="plugin-anchor" href="#&#x7528;&#x9014;&#x548C;&#x5173;&#x7CFB;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7528;&#x9014;&#x548C;&#x5173;&#x7CFB;</h3>
<p>uts&#x662F;&#x4E00;&#x95E8;&#x8BED;&#x8A00;&#x3002;&#x4E5F;&#x4EC5;&#x662F;&#x4E00;&#x95E8;&#x8BED;&#x8A00;&#xFF0C;&#x4E0D;&#x5305;&#x542B;ui&#x6846;&#x67B6;&#x3002;</p>
<p>uvue&#x662F;DCloud&#x63D0;&#x4F9B;&#x7684;&#x8DE8;&#x5E73;&#x53F0;&#x7684;&#x3001;&#x57FA;&#x4E8E;uts&#x7684;&#x3001;&#x4F7F;&#x7528;vue&#x65B9;&#x5F0F;&#x7684;ui&#x6846;&#x67B6;&#x3002;</p>
<p>uts&#x76F8;&#x5F53;&#x4E8E;js&#xFF0C;uvue&#x76F8;&#x5F53;&#x4E8E;html&#x548C;css&#x3002;&#x5B83;&#x4EEC;&#x7C7B;&#x4F3C;&#x4E8E;v8&#x548C;webkit&#x7684;&#x5173;&#x7CFB;&#xFF0C;&#x6216;&#x8005;&#x7C7B;&#x4F3C;&#x4E8E;dart&#x548C;flutter&#x7684;&#x5173;&#x7CFB;&#x3002;</p>
<p>uts&#x8FD9;&#x95E8;&#x8BED;&#x8A00;&#xFF0C;&#x6709;2&#x4E2A;&#x7528;&#x9014;&#xFF1A;</p>
<ol>
<li>&#x5F00;&#x53D1;uni-app &#x548C; uni-app x &#x7684;&#x539F;&#x751F;&#x6269;&#x5C55;&#x63D2;&#x4EF6;&#xFF1A;&#x56E0;&#x4E3A;uts&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x6240;&#x6709;&#x539F;&#x751F;&#x80FD;&#x529B;&#x3002;</li>
<li>uts&#x548C;uvue&#x4E00;&#x8D77;&#x7EC4;&#x5408;&#xFF0C;&#x5F00;&#x53D1;&#x539F;&#x751F;&#x7EA7;&#x7684;&#x9879;&#x76EE;&#xFF0C;&#x4E5F;&#x5C31;&#x662F; uni-app x &#x9879;&#x76EE;</li>
</ol>
<p>&#x4ECE;HBuilderX 3.9&#x8D77;&#xFF0C;&#x652F;&#x6301;uni-app x&#x9879;&#x76EE;&#x3002;&#x8BE6;&#x89C1;<a href="https://doc.dcloud.net.cn/uni-app-x/index.html" target="_blank">uni-app x</a></p>
<p>&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#xFF0C;uts&#x53EF;&#x4EE5;&#x5728;uni-app&#x4E2D;&#x4F7F;&#x7528;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5728;uni-app x&#x4E2D;&#x4F7F;&#x7528;&#x3002;</p>
<ul>
<li>&#x5728;uni-app&#x4E2D;&#xFF0C;&#x4E3B;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x662F;js&#x3002;uts&#x53EF;&#x4EE5;&#x5F00;&#x53D1;&#x539F;&#x751F;&#x63D2;&#x4EF6;&#xFF0C;&#x5305;&#x62EC;API&#x63D2;&#x4EF6;&#x548C;&#x7EC4;&#x4EF6;&#x63D2;&#x4EF6;&#x3002;</li>
<li>&#x5728;uni-app x&#x4E2D;&#xFF0C;&#x4E3B;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x662F;uts&#x3002;&#x4E0D;&#x7BA1;&#x662F;&#x5E94;&#x7528;&#x903B;&#x8F91;&#x8FD8;&#x662F;&#x6269;&#x5C55;&#x63D2;&#x4EF6;&#xFF0C;&#x5747;&#x4F7F;&#x7528;uts&#x7F16;&#x7A0B;&#x3002;&#x4EC5;&#x5728;Web&#x5E73;&#x53F0;&#x548C;iOS&#x7684;js&#x9A71;&#x52A8;&#x6A21;&#x5F0F;&#x4E0B;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;js&#x3002;</li>
</ul>
<p>&#x5982;&#x679C;&#x63D2;&#x4EF6;&#x4F5C;&#x8005;&#xFF0C;&#x5F00;&#x53D1;&#x4E86;uts&#x63D2;&#x4EF6;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x5728;uni-app&#x548C;uni-app x&#x4E2D;&#x4F7F;&#x7528;&#x3002;&#x6BD4;&#x5982;&#x8FD9;2&#x4E2A;uts&#x63D2;&#x4EF6;&#xFF1A;</p>
<ul>
<li>&#x7535;&#x91CF;&#xFF1A;<a href="https://ext.dcloud.net.cn/plugin?id=9295" target="_blank">https://ext.dcloud.net.cn/plugin?id=9295</a></li>
<li>lottie&#x7EC4;&#x4EF6;&#xFF1A;<a href="https://ext.dcloud.net.cn/plugin?id=10674" target="_blank">https://ext.dcloud.net.cn/plugin?id=10674</a></li>
</ul>
<p>&#x8FD9;2&#x4E2A;uts&#x63D2;&#x4EF6;&#xFF0C;&#x4E00;&#x4E2A;&#x662F;api&#x63D2;&#x4EF6;&#xFF0C;&#x4E00;&#x4E2A;&#x662F;&#x7EC4;&#x4EF6;&#x63D2;&#x4EF6;&#xFF0C;&#x5B83;&#x4EEC;&#x540C;&#x65F6;&#x517C;&#x5BB9;uni-app&#x548C;uni-app x&#x3002;</p>
<p>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8868;&#x683C;&#x66F4;&#x6E05;&#x6670;&#x7684;&#x4E86;&#x89E3;uts&#x8BED;&#x8A00;&#x5728;uni-app&#x548C;uni-app x&#x4E0B;&#x7684;&#x7F16;&#x8BD1;&#x5173;&#x7CFB;&#x3002;</p>
<table>
<thead>
<tr>
<th></th>
<th>uni-app</th>
<th>uni-app x</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>&#x666E;&#x901A;&#x9875;&#x9762;&#x548C;&#x811A;&#x672C;</td>
<td>uts&#x63D2;&#x4EF6;</td>
<td>&#x666E;&#x901A;&#x9875;&#x9762;&#x548C;&#x811A;&#x672C;</td>
<td>uts&#x63D2;&#x4EF6;</td>
</tr>
<tr>
<td>Web&#x548C;&#x5C0F;&#x7A0B;&#x5E8F;</td>
<td>JS</td>
<td>JS</td>
<td>JS</td>
<td>JS</td>
</tr>
<tr>
<td>Android</td>
<td>JS</td>
<td>Kotlin</td>
<td>Kotlin</td>
<td>Kotlin</td>
</tr>
<tr>
<td>iOS</td>
<td>JS</td>
<td>Swift</td>
<td>JS(JS&#x9A71;&#x52A8;&#x65F6;)</td>
<td>Swift</td>
</tr>
<tr>
<td>HarmonyNext</td>
<td>JS</td>
<td>ArkTS</td>
<td>x</td>
<td>x</td>
</tr>
</tbody>
</table>
<p>&#x8FD9;&#x91CC;&#x7684;&#x6982;&#x5FF5;&#x89E3;&#x91CA;&#x662F;&#xFF1A;</p>
<ul>
<li>uts&#x63D2;&#x4EF6;&#xFF0C;&#x6307;<code>uni_modules</code>&#x76EE;&#x5F55;&#x4E0B;utssdk&#x76EE;&#x5F55;&#x4E0B;&#x7684;&#x4EE3;&#x7801;</li>
<li>&#x9664;uts&#x63D2;&#x4EF6;&#x5916;&#xFF0C;&#x5176;&#x4ED6;&#x90FD;&#x5C5E;&#x4E8E; <code>&#x666E;&#x901A;&#x9875;&#x9762;&#x548C;&#x811A;&#x672C;</code>&#xFF0C;&#x5305;&#x542B;vue&#x3001;nvue&#x3001;uvue&#x7B49;&#x9875;&#x9762;&#x53CA;&#x5355;&#x72EC;&#x7684;uts&#x6587;&#x4EF6;</li>
<li>&#x5728;uni-app x&#x7684;iOS&#x5E73;&#x53F0;&#xFF0C;&#x76EE;&#x524D;<code>&#x666E;&#x901A;&#x9875;&#x9762;&#x548C;&#x811A;&#x672C;</code>&#x662F;&#x7F16;&#x8BD1;&#x4E3A;js&#x7684;&#xFF0C;&#x800C;&#x4E0D;&#x662F;Swift&#x3002; &#x8FD9;&#x4E2A;&#x7B56;&#x7565;&#x4E3B;&#x8981;&#x662F;&#x4E3A;&#x4E86;&#x89E3;&#x51B3;windows&#x7535;&#x8111;&#x5F00;&#x53D1;uni-app x&#x7684;&#x95EE;&#x9898;&#x3002;&#x5B83;&#x5E76;&#x4E0D;&#x5F71;&#x54CD;&#x6027;&#x80FD;&#xFF0C;uni-app x&#x7684;iOS&#x901A;&#x8FC7;&#x4F18;&#x5316;&#x89E3;&#x51B3;&#x4E86;js&#x6027;&#x80FD;&#x95EE;&#x9898;&#x3002;&#x540C;&#x65F6;&#x672A;&#x6765;&#x4E5F;&#x4F1A;&#x63D0;&#x4F9B;js&#x9A71;&#x52A8;&#x548C;Swift&#x9A71;&#x52A8;&#x53CC;&#x9009;</li>
</ul>
<p>&#x9664;&#x4E86;&#x67E5;&#x9605;&#x8868;&#x683C;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x7B80;&#x5355;&#x7684;&#x8BB0;3&#x4E2A;&#x539F;&#x5219;&#xFF1A;</p>
<ol>
<li>&#x6240;&#x6709;&#x7684;uts&#x63D2;&#x4EF6;&#xFF0C;&#x90FD;&#x4F1A;&#x7F16;&#x8BD1;&#x4E3A;&#x539F;&#x751F;&#x8BED;&#x8A00;</li>
<li>web&#x548C;&#x5C0F;&#x7A0B;&#x5E8F;&#x4E0A;&#xFF0C;&#x539F;&#x751F;&#x8BED;&#x8A00;&#x5C31;&#x662F;js</li>
<li>App&#x4E0A;&#xFF0C;&#x76EE;&#x524D;&#x4EC5;uni-app x&#x7684;Android&#x5E73;&#x53F0;&#x4F1A;&#x7F16;&#x8BD1;&#x4E3A;&#x539F;&#x751F;&#x8BED;&#x8A00;&#xFF0C;&#x5176;&#x4ED6;&#x90FD;&#x7F16;&#x8BD1;&#x4E3A;js</li>
</ol>
<p>&#x672C;&#x6587;&#x662F; uts &#x7684;&#x57FA;&#x672C;&#x8BED;&#x6CD5;&#x4ECB;&#x7ECD;&#x3002;</p>
<ul>
<li>&#x60F3;&#x4E86;&#x89E3; uni-app &#x4E0B;&#x5982;&#x4F55;&#x5F00;&#x53D1; uts&#x63D2;&#x4EF6;&#xFF0C;&#x53E6;&#x89C1;&#x6587;&#x6863;<a href="https://doc.dcloud.net.cn/uni-app-x/plugin/uts-plugin.html" target="_blank">https://doc.dcloud.net.cn/uni-app-x/plugin/uts-plugin.html</a></li>
<li>&#x60F3;&#x4E86;&#x89E3; uni-app x&#xFF0C;&#x53E6;&#x89C1;&#x6587;&#x6863;<a href="https://doc.dcloud.net.cn/uni-app-x/index.html" target="_blank">https://doc.dcloud.net.cn/uni-app-x/</a></li>
</ul>
<h2 id="&#x7C7B;&#x578B;&#x58F0;&#x660E;"><a name="&#x7C7B;&#x578B;&#x58F0;&#x660E;" class="plugin-anchor" href="#&#x7C7B;&#x578B;&#x58F0;&#x660E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7C7B;&#x578B;&#x58F0;&#x660E;</h2>
<p>js&#x662F;&#x65E0;&#x7C7B;&#x578B;&#x7684;&#xFF0C;TypeScript &#x7684; type &#x5C31;&#x662F;&#x7C7B;&#x578B;&#x7684;&#x610F;&#x601D;&#xFF0C;&#x7ED9;js&#x52A0;&#x4E0A;&#x4E86;&#x7C7B;&#x578B;&#x3002;&#x5B83;&#x7684;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;&#x65B9;&#x5F0F;&#x662F;&#x5728;&#x53D8;&#x91CF;&#x540D;&#x540E;&#x9762;&#x901A;&#x8FC7;&#x52A0;&#x5192;&#x53F7;&#x548C;&#x7C7B;&#x578B;&#x6765;&#x8FDB;&#x884C;&#x5B9A;&#x4E49;&#x3002;</p>
<p>uts &#x4E2D;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x53EF;&#x4EE5;&#x7528; let &#x6216; const&#xFF0C;&#x8BE6;&#x89C1;&#x4E0B;&#x3002;</p>
<h3 id="&#x53D8;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;let&#xFF09;"><a name="&#x53D8;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;let&#xFF09;" class="plugin-anchor" href="#&#x53D8;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;let&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x53D8;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;let&#xFF09;</h3>
<p>&#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x53EF;&#x91CD;&#x65B0;&#x8D4B;&#x503C;&#x7684;&#x53D8;&#x91CF;&#x3002;&#x8BED;&#x6CD5; <code>let [&#x53D8;&#x91CF;&#x540D;] : [&#x7C7B;&#x578B;] = &#x503C;;</code>&#x3002;</p>
<blockquote>
<p>&#x76F8;&#x5F53;&#x4E8E; TypeScript &#x4E2D;&#x7684; let&#x3001;kotlin &#x4E2D;&#x7684; var&#x3001;swift &#x4E2D;&#x7684; var&#x3002;</p>
</blockquote>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> str :<span class="hljs-built_in">string</span> = <span class="hljs-string">&quot;hello&quot;</span>; <span class="hljs-comment">// &#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x53D8;&#x91CF;</span>
str = <span class="hljs-string">&quot;hello world&quot;</span>; <span class="hljs-comment">// &#x91CD;&#x65B0;&#x8D4B;&#x503C;</span>
</code></pre>
<p>&#x7C7B;&#x578B;&#x9664;&#x4E86; string &#x4E4B;&#x5916;&#xFF0C;&#x66F4;&#x591A;&#x7C7B;&#x578B;&#x89C1;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/data-type.html" target="_blank">&#x6570;&#x636E;&#x7C7B;&#x578B;</a></p>
<h3 id="&#x5E38;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;const&#xFF09;"><a name="&#x5E38;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;const&#xFF09;" class="plugin-anchor" href="#&#x5E38;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;const&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5E38;&#x91CF;&#x5B9A;&#x4E49;&#xFF08;const&#xFF09;</h3>
<p>&#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x53EA;&#x8BFB;&#x5E38;&#x91CF;&#xFF0C;&#x53EA;&#x80FD;&#x4E3A;&#x5176;&#x8D4B;&#x503C;&#x4E00;&#x6B21;&#x3002;&#x8BED;&#x6CD5; <code>const [&#x53D8;&#x91CF;&#x540D;] : [&#x7C7B;&#x578B;] = &#x503C;;</code>&#x3002;</p>
<blockquote>
<p>&#x76F8;&#x5F53;&#x4E8E; TypeScript &#x4E2D;&#x7684; const&#x3001;kotlin &#x4E2D;&#x7684; val&#x3001;swift &#x4E2D;&#x7684; let&#x3002;</p>
</blockquote>
<pre><code class="lang-ts"><span class="hljs-keyword">const</span> str :<span class="hljs-built_in">string</span> = <span class="hljs-string">&quot;hello&quot;</span>; <span class="hljs-comment">// &#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x5E38;&#x91CF;</span>
str = <span class="hljs-string">&quot;hello world&quot;</span>; <span class="hljs-comment">// &#x62A5;&#x9519;&#xFF0C;&#x4E0D;&#x5141;&#x8BB8;&#x91CD;&#x65B0;&#x8D4B;&#x503C;</span>
</code></pre>
<p>&#x6CE8;&#x610F;&#x4E8B;&#x9879;&#xFF1A;</p>
<p>&#x5F53;&#x524D; uts &#x5E76;&#x672A;&#x9650;&#x5236;&#x4F7F;&#x7528;var&#x6765;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#xFF0C;&#x4F46;&#x9664;&#x975E;&#x4F60;&#x77E5;&#x9053;&#x4F60;&#x5728;&#x505A;&#x4EC0;&#x4E48;&#xFF0C;&#x5426;&#x5219;&#x4E0D;&#x8981;&#x8F7B;&#x6613;&#x4F7F;&#x7528;&#x5B83;&#xFF0C;&#x56E0;&#x4E3A;&#x6709;&#x4E0D;&#x540C;&#x5E73;&#x53F0;&#x5DEE;&#x5F02;&#xFF1A;</p>
<ul>
<li>&#x7F16;&#x8BD1;&#x81F3; JavaScript &#x5E73;&#x53F0;&#x65F6;&#xFF0C;&#x7B49;&#x540C;&#x4E8E; JavaScript &#x5E73;&#x53F0;&#x7684; var &#x3002;&#x5B58;&#x5728;&#x53D8;&#x91CF;&#x63D0;&#x5347;&#x73B0;&#x8C61;&#xFF0C;&#x5177;&#x4F53;&#x53C2;&#x8003; <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types#&#x58F0;&#x660E;" target="_blank">var&#x548C;let&#x7684;&#x533A;&#x522B;</a></li>
<li><p>&#x7F16;&#x8BD1;&#x81F3; Kotlin &#x5E73;&#x53F0;&#x65F6;&#xFF0C;&#x7B49;&#x540C;&#x4E8E; Kotlin &#x5E73;&#x53F0;&#x7684; var&#xFF08;&#x5141;&#x8BB8;&#x91CD;&#x65B0;&#x8D4B;&#x503C;&#xFF09;</p>
</li>
<li><p>swift &#x4E2D; let &#x662F;&#x5B9A;&#x4E49;&#x5E38;&#x91CF;&#xFF0C;&#x800C; uts &#x548C; ts &#x4E2D;&#xFF0C;let &#x662F;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x3002;&#x6CE8;&#x610F;&#x52FF;&#x6DF7;&#x6DC6;&#x3002;</p>
</li>
<li>&#x7C7B;&#x578B;&#x5B9A;&#x4E49;&#x7684;&#x5192;&#x53F7;&#xFF0C;&#x5DE6;&#x53F3;&#x53EF;&#x4EE5;&#x6709;&#x4E00;&#x4E2A;&#x7A7A;&#x683C;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x6CA1;&#x6709;&#x7A7A;&#x683C;&#x3002;<code>let str:string</code> &#x548C; <code>let str : string</code> &#x548C; <code>let str :string</code> &#x548C; <code>let str: string</code> &#x90FD;&#x662F;&#x5408;&#x6CD5;&#x7684;&#x3002;</li>
</ul>
<h3 id="&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x5219;"><a name="&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x5219;" class="plugin-anchor" href="#&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x5219;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x5219;</h3>
<p>&#x5728; uts &#x4E2D;&#xFF0C;&#x4F7F;&#x7528;&#x53D8;&#x91CF;&#x540D;&#x9700;&#x8981;&#x9075;&#x5B88;&#x4E00;&#x5B9A;&#x7684;&#x89C4;&#x5219;&#x3002;</p>
<ul>
<li>&#x53D8;&#x91CF;&#x540D;&#x79F0;&#x53EF;&#x4EE5;&#x5305;&#x542B;&#x6570;&#x5B57;&#x548C;&#x5B57;&#x6BCD;&#x3002;</li>
<li>&#x9664;&#x4E86;&#x4E0B;&#x5212;&#x7EBF; _ &#x5916;&#xFF0C;&#x4E0D;&#x80FD;&#x5305;&#x542B;&#x5176;&#x4ED6;&#x7279;&#x6B8A;&#x5B57;&#x7B26;&#xFF0C;&#x5305;&#x62EC;&#x7A7A;&#x683C;&#x3002;</li>
<li>&#x53D8;&#x91CF;&#x540D;&#x4E0D;&#x80FD;&#x4EE5;&#x6570;&#x5B57;&#x5F00;&#x5934;&#x3002;</li>
</ul>
<blockquote>
<p>&#x6CE8;&#x610F;&#xFF1A;&#x4E0E; TypeScript &#x4E0D;&#x540C;&#x7684;&#x662F;&#xFF0C;uts &#x4E0D;&#x5141;&#x8BB8;&#x4EE5; $ &#x5F00;&#x5934;&#x547D;&#x540D;&#x53D8;&#x91CF;</p>
</blockquote>
<h3 id="&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x53CA;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;"><a name="&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x53CA;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;" class="plugin-anchor" href="#&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x53CA;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x53CA;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;</h3>
<p>&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x3001;&#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x4E5F;&#x901A;&#x8FC7;&#x5192;&#x53F7;&#x5B9A;&#x4E49;&#x3002;</p>
<p>&#x5982;&#x4E0B;&#x793A;&#x4F8B;&#xFF0C;&#x65B9;&#x6CD5;test&#xFF0C;&#x6709;&#x4E00;&#x4E2A;&#x53C2;&#x6570;score&#xFF0C;&#x662F;number&#x7C7B;&#x578B;&#xFF0C;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#x4E3A;boolean&#x7C7B;&#x578B;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">test</span>(<span class="hljs-params">score: <span class="hljs-built_in">number</span></span>): <span class="hljs-title">boolean</span> </span>{
    <span class="hljs-keyword">return</span> (score&gt;=<span class="hljs-number">60</span>)
}
test(<span class="hljs-number">61</span>) <span class="hljs-comment">// &#x8FD4;&#x56DE;true</span>
</code></pre>
<p>&#x65B9;&#x6CD5;&#x65E0;&#x8FD4;&#x56DE;&#x503C;&#x65F6;&#xFF0C;&#x4F7F;&#x7528;<code>:void</code>&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">x :<span class="hljs-built_in">string</span>, y :<span class="hljs-built_in">string</span></span>) :<span class="hljs-title">void</span> </span>{
    <span class="hljs-keyword">let</span> z :<span class="hljs-built_in">string</span> = x + <span class="hljs-string">&quot; &quot;</span> + y
    <span class="hljs-built_in">console</span>.log(z)
    <span class="hljs-comment">// &#x4E0D;&#x9700;&#x8981;return</span>
}
</code></pre>
<p>&#x51FD;&#x6570;&#x53E6;&#x6709;&#x8BE6;&#x7EC6;&#x6587;&#x6863;&#xFF0C;&#x8BE6;&#x89C1;&#xFF1A;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/function.html" target="_blank">&#x51FD;&#x6570;</a></p>
<h3 id="vue-data&#x7C7B;&#x578B;&#x5B9A;&#x4E49;"><a name="vue-data&#x7C7B;&#x578B;&#x5B9A;&#x4E49;" class="plugin-anchor" href="#vue-data&#x7C7B;&#x578B;&#x5B9A;&#x4E49;"><i class="fa fa-link" aria-hidden="true"></i></a>vue data&#x7C7B;&#x578B;&#x5B9A;&#x4E49;</h3>
<p>vue &#x9009;&#x9879;&#x5F0F;&#x5F00;&#x53D1;&#x65F6;&#xFF0C;&#x5192;&#x53F7;&#x88AB;&#x7528;&#x4E8E;&#x8D4B;&#x503C;&#xFF0C;&#x65E0;&#x6CD5;&#x901A;&#x8FC7;let&#x3001;const&#x548C;&#x5192;&#x53F7;&#x6765;&#x5B9A;&#x4E49;data&#x6570;&#x636E;&#x7684;&#x7C7B;&#x578B;&#x3002;</p>
<p>&#x6B64;&#x65F6;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/literal.html" target="_blank">&#x5B57;&#x9762;&#x91CF;</a>&#x8D4B;&#x503C;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#xFF1B;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>as</code> &#x5173;&#x952E;&#x5B57;&#x6765;&#x663E;&#x5F0F;&#x58F0;&#x660E;&#x7C7B;&#x578B;&#x3002;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">&quot;uts&quot;</span>&gt;</span><span class="javascript">
    <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> {
        data() {
            <span class="hljs-keyword">const</span> date = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>()
            <span class="hljs-keyword">return</span> {
                s1 : <span class="hljs-string">&quot;abc&quot;</span>, <span class="hljs-comment">// &#x6839;&#x636E;&#x5B57;&#x9762;&#x91CF;&#x63A8;&#x5BFC;&#x4E3A;string</span>
                n1 : <span class="hljs-number">0</span> <span class="hljs-keyword">as</span> number, <span class="hljs-comment">// &#x8FD9;&#x91CC;&#x5176;&#x5B9E;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x5B57;&#x9762;&#x91CF;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#xFF0C;as number&#x5199;&#x4E0D;&#x5199;&#x90FD;&#x884C;</span>
                n2, <span class="hljs-comment">// &#x4E0D;&#x5408;&#x6CD5;&#xFF0C;&#x5FC5;&#x987B;&#x6307;&#x5B9A;&#x7C7B;&#x578B;</span>
                n3 <span class="hljs-keyword">as</span> number, <span class="hljs-comment">// &#x4E0D;&#x5408;&#x6CD5;&#xFF0C;uts&#x4E0D;&#x652F;&#x6301;undefined&#xFF0C;&#x5FC5;&#x987B;&#x901A;&#x8FC7;&#x5192;&#x53F7;&#x521D;&#x59CB;&#x5316;&#x8D4B;&#x503C;&#xFF0C;&#x54EA;&#x6015;&#x8D4B;&#x503C;&#x4E3A;null&#xFF0C;&#x89C1;&#x4E0B;</span>
                n4 : <span class="hljs-literal">null</span> <span class="hljs-keyword">as</span> number | <span class="hljs-literal">null</span> <span class="hljs-comment">// &#x5408;&#x6CD5;&#x3002;&#x5B9A;&#x4E49;&#x4E3A;&#x53EF;&#x4E3A;null&#x7684;&#x6570;&#x5B57;&#xFF0C;&#x521D;&#x59CB;&#x503C;&#x662F;null&#xFF0C;&#x4F46;&#x5728;&#x4F7F;&#x7528;n4&#x524D;&#x5FC5;&#x987B;&#x4E3A;&#x5176;&#x8D4B;&#x503C;&#x6570;&#x5B57;&#x3002;&#xFF08;number | null&#xFF09;&#x662F;&#x4E00;&#x4E2A;&#x6216;&#x7684;&#x5199;&#x6CD5;&#xFF0C;&#x524D;&#x540E;&#x987A;&#x5E8F;&#x6CA1;&#x6709;&#x5173;&#x7CFB;&#x3002;uts&#x7684;&#x8054;&#x5408;&#x7C7B;&#x578B;&#x53EA;&#x652F;&#x6301; |null &#x3002;</span>
                year: date.getFullYear() <span class="hljs-keyword">as</span> number, <span class="hljs-comment">// &#x5728;data&#x91CC;&#xFF0C;&#x76EE;&#x524D;&#x65E0;&#x6CD5;&#x901A;&#x8FC7;&#x53D8;&#x91CF;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;data&#x9879;&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x9700;&#x4F7F;&#x7528; as &#x663E;&#x5F0F;&#x58F0;&#x660E;&#x7C7B;&#x578B;&#x4E3A;number</span>
            }
        }
    }
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
<p>&#x4E0A;&#x8FF0;&#x793A;&#x4F8B;&#x4EC5;&#x5728; uni-app x &#x7684;uvue&#x9875;&#x9762;&#x751F;&#x6548;&#x3002;&#x8001;&#x7248;uni-app&#xFF0C;&#x5373;js&#x5F15;&#x64CE;&#x7248;&#xFF0C;&#x4E0D;&#x652F;&#x6301;&#x5728;&#x9875;&#x9762;&#x91CC;&#x5199;uts&#x4EE3;&#x7801;&#xFF0C;&#x53EA;&#x652F;&#x6301;&#x5728;uts&#x63D2;&#x4EF6;&#x91CC;&#x5199;uts&#x4EE3;&#x7801;&#x3002;</p>
<h3 id="&#x7C7B;&#x578B;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;"><a name="&#x7C7B;&#x578B;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;" class="plugin-anchor" href="#&#x7C7B;&#x578B;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7C7B;&#x578B;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;</h3>
<p>&#x73B0;&#x4EE3;&#x8BED;&#x8A00;&#xFF08;ts&#x3001;kotlin&#x3001;swift&#xFF09;&#xFF0C;&#x90FD;&#x5177;&#x5907;&#x81EA;&#x52A8;&#x8BC6;&#x522B;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/literal.html" target="_blank">&#x5B57;&#x9762;&#x91CF;</a>&#xFF0C;&#x8FDB;&#x884C;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;&#x7684;&#x529F;&#x80FD;&#x3002;</p>
<p>&#x5373;&#xFF1A;&#x5982;&#x679C;&#x5F00;&#x53D1;&#x8005;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x7684;&#x540C;&#x65F6;&#xFF0C;&#x8FDB;&#x884C;&#x4E86;&#x521D;&#x59CB;&#x5316;&#x8D4B;&#x503C;&#x3002;&#x90A3;&#x4E48;&#x7F16;&#x8BD1;&#x5668;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x8D4B;&#x503C;&#x7684;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/literal.html" target="_blank">&#x5B57;&#x9762;&#x91CF;</a>&#xFF0C;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#x51FA;&#x53D8;&#x91CF;&#x7C7B;&#x578B;&#xFF0C;&#x4E0D;&#x5FC5;&#x5F00;&#x53D1;&#x8005;&#x663E;&#x5F0F;&#x58F0;&#x660E;&#x3002;</p>
<p>&#x5728;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x65F6;&#x5982;&#x679C;&#x76F4;&#x63A5;&#x8D4B;&#x503C;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/literal.html" target="_blank">&#x5B57;&#x9762;&#x91CF;</a>&#xFF0C;&#x800C;&#x4E0D;&#x4F7F;&#x7528;&#x5192;&#x53F7;&#x58F0;&#x660E;&#x7C7B;&#x578B;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5408;&#x6CD5;&#x8FD0;&#x884C;&#x3002;</p>
<p>&#x5982;&#x4E0B;2&#x79CD;&#x5199;&#x6CD5;&#x90FD;&#x662F;&#x5408;&#x6CD5;&#x7684;&#xFF0C;&#x4E24;&#x4E2A;&#x53D8;&#x91CF;&#x90FD;&#x662F;string&#x7C7B;&#x578B;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-comment">// &#x4EE5;&#x4E0B;&#x6BCF;&#x7EC4;&#x5199;&#x6CD5;&#x662F;&#x7B49;&#x4EF7;&#x7684;</span>
<span class="hljs-keyword">let</span> s1 = <span class="hljs-string">&quot;hello&quot;</span> <span class="hljs-comment">// &#x6839;&#x636E;&#x5B57;&#x9762;&#x91CF; &quot;hello&quot;&#xFF0C;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#x4E3A;string&#x7C7B;&#x578B;</span>
<span class="hljs-keyword">let</span> s2 : <span class="hljs-built_in">string</span> = <span class="hljs-string">&quot;hello&quot;</span>
<span class="hljs-keyword">let</span> s3 : <span class="hljs-built_in">string</span>
s3 = <span class="hljs-string">&quot;hello&quot;</span>

<span class="hljs-keyword">let</span> b1 = <span class="hljs-literal">true</span> <span class="hljs-comment">// &#x6839;&#x636E;&#x5B57;&#x9762;&#x91CF; true&#xFF0C;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#x4E3A;boolean&#x7C7B;&#x578B;</span>
<span class="hljs-keyword">let</span> b2 : <span class="hljs-built_in">boolean</span> = <span class="hljs-literal">true</span>

<span class="hljs-comment">// &#x4EE5;&#x4E0A;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x548C;&#x5E03;&#x5C14;&#x7684;&#x5B57;&#x9762;&#x91CF;&#x7C7B;&#x578B;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#xFF0C;&#x6570;&#x5B57;&#x548C;&#x6570;&#x7EC4;&#x4E5F;&#x652F;&#x6301;&#x5B57;&#x9762;&#x91CF;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;&#xFF0C;&#x4F46;&#x89C4;&#x5219;&#x6BD4;&#x8F83;&#x590D;&#x6742;&#xFF0C;&#x9700;&#x53E6;&#x89C1;&#x6587;&#x6863;</span>
</code></pre>
<p>&#x5728;HBuilderX 3.9&#x4EE5;&#x524D;&#xFF0C; uts &#x672A;&#x5BF9;&#x5B57;&#x9762;&#x91CF;&#x8D4B;&#x503C;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;&#x505A;&#x7EDF;&#x4E00;&#x5904;&#x7406;&#xFF0C;&#x7F16;&#x8BD1;&#x5230; kotlin &#x548C; swift &#x65F6;&#xFF0C;&#x7531;&#x8FD9;2&#x4E2A;&#x8BED;&#x8A00;&#x81EA;&#x884C;&#x505A;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;&#x3002;</p>
<p>&#x4F46; kotlin &#x548C; swift &#x7684;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#xFF0C;&#x5728;&#x67D0;&#x4E9B;&#x5730;&#x65B9;&#x6709;&#x7EC6;&#x8282;&#x5DEE;&#x5F02;&#x3002;&#x5C24;&#x5176;&#x662F;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/data-type.html#autotypefornumber" target="_blank">&#x6570;&#x5B57;&#x5B57;&#x9762;&#x91CF;</a>&#x548C;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/data-type.html#autotypeforarray" target="_blank">&#x6570;&#x7EC4;&#x5B57;&#x9762;&#x91CF;</a>&#x3002;&#x5728;&#x8FD9;2&#x4E2A;&#x573A;&#x666F;&#x4E0B;&#xFF0C;&#x5EFA;&#x8BAE;&#x663E;&#x5F0F;&#x58F0;&#x660E;&#x7C7B;&#x578B;&#xFF0C;&#x4E0D;&#x4F7F;&#x7528;&#x81EA;&#x52A8;&#x63A8;&#x5BFC;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-comment">// &#x663E;&#x5F0F;&#x58F0;&#x660E;&#x6570;&#x5B57;&#x548C;&#x6570;&#x7EC4;&#x7C7B;&#x578B;</span>
<span class="hljs-keyword">let</span> n1:<span class="hljs-built_in">number</span> = <span class="hljs-number">1</span>
<span class="hljs-keyword">let</span> n2 = <span class="hljs-number">1</span> as <span class="hljs-built_in">number</span>
<span class="hljs-keyword">let</span> n3:Int = <span class="hljs-number">1</span>
<span class="hljs-keyword">let</span> a1:<span class="hljs-built_in">Array</span>&lt;<span class="hljs-built_in">string</span>&gt; = [<span class="hljs-string">&quot;uni-app&quot;</span>, <span class="hljs-string">&quot;uniCloud&quot;</span>, <span class="hljs-string">&quot;HBuilder&quot;</span>]
<span class="hljs-keyword">let</span> a1:<span class="hljs-built_in">Array</span>&lt;<span class="hljs-built_in">number</span>&gt; = [<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>]
</code></pre>
<p>&#x590D;&#x5236;&#x4EE3;&#x7801;</p>
<p>HBuilderX 3.9+&#xFF0C; uts &#x7EDF;&#x4E00;&#x4E86;&#x5B57;&#x9762;&#x91CF;&#x81EA;&#x52A8;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;&#x3002;</p>
<p>&#x5EFA;&#x8BAE;&#x63D2;&#x4EF6;&#x4F5C;&#x8005;&#xFF0C;&#x9664;&#x4E86;boolean&#x548C;string&#x5916;&#xFF0C;&#x5176;&#x4ED6;&#x5305;&#x62EC;&#x6570;&#x5B57;&#x548C;&#x6570;&#x7EC4;&#x5728;&#x5185;&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x5C3D;&#x91CF;&#x4E0D;&#x4F7F;&#x7528;&#x5B57;&#x9762;&#x91CF;&#x81EA;&#x52A8;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;&#xFF0C;&#x800C;&#x662F;&#x663E;&#x5F0F;&#x58F0;&#x660E;&#x7C7B;&#x578B;&#x3002;&#x907F;&#x514D; uts &#x7EDF;&#x4E00;&#x81EA;&#x52A8;&#x7C7B;&#x578B;&#x63A8;&#x5BFC;&#x65F6;&#x5F15;&#x53D1;&#x7684;&#x5411;&#x4E0B;&#x517C;&#x5BB9;&#x95EE;&#x9898;&#x3002;</p>
<h3 id="&#x7C7B;&#x578B;&#x5224;&#x65AD;"><a name="&#x7C7B;&#x578B;&#x5224;&#x65AD;" class="plugin-anchor" href="#&#x7C7B;&#x578B;&#x5224;&#x65AD;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7C7B;&#x578B;&#x5224;&#x65AD;</h3>
<p>&#x5224;&#x65AD;&#x7C7B;&#x578B;&#xFF0C;&#x6709;&#x597D;&#x51E0;&#x79CD;&#x65B9;&#x6848;&#xFF1A;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/operator.html#typeof" target="_blank">typeof</a>&#x3001;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/operator.html#instanceof" target="_blank">instanceof</a>&#x3001;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/buildin-object-api/array.html#isarray" target="_blank">isArray</a>&#x3002;</p>
<p>&#x4F7F;&#x7528; typeof &#x53EF;&#x4EE5;&#x5224;&#x65AD;&#x5E03;&#x5C14;&#x503C;&#x3001;&#x6570;&#x5B57;&#x3001;&#x5B57;&#x7B26;&#x4E32;&#x3001;&#x51FD;&#x6570;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">typeof</span>(<span class="hljs-literal">true</span>) == <span class="hljs-string">&quot;boolean&quot;</span>
<span class="hljs-keyword">typeof</span>(<span class="hljs-string">&quot;abc&quot;</span>) == <span class="hljs-string">&quot;string&quot;</span>

<span class="hljs-keyword">let</span> n1 : <span class="hljs-built_in">number</span> = <span class="hljs-number">1</span>
<span class="hljs-keyword">typeof</span>(n1) == <span class="hljs-string">&quot;number&quot;</span>
</code></pre>
<p>&#x590D;&#x5236;&#x4EE3;&#x7801;</p>
<p>&#x4F46;&#x5982;&#x679C;&#x4F7F;&#x7528; typeof &#x9A8C;&#x8BC1;&#x6570;&#x7EC4;&#xFF0C;&#x4F1A;&#x53D1;&#x73B0;&#x8FD4;&#x56DE;&#x7684;&#x7C7B;&#x578B;&#x503C;&#x662F;&quot;object&quot;&#xFF0C;&#x8FD9;&#x4E0E;&#x6D4F;&#x89C8;&#x5668;&#x662F;&#x76F8;&#x540C;&#x7684;&#x903B;&#x8F91;&#x3002;</p>
<p>&#x5982;&#x679C;&#x60F3;&#x9A8C;&#x8BC1;&#x6570;&#x7EC4;&#x7C7B;&#x578B;&#xFF0C;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x5982;&#x4E0B;&#x65B9;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">const</span> a1 = [<span class="hljs-string">&quot;uni-app&quot;</span>, <span class="hljs-string">&quot;uniCloud&quot;</span>, <span class="hljs-string">&quot;HBuilder&quot;</span>]
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Array</span>.isArray(a1)) <span class="hljs-comment">// &#x8FD4;&#x56DE;true</span>
<span class="hljs-built_in">console</span>.log(a1 <span class="hljs-keyword">instanceof</span> <span class="hljs-built_in">Array</span>) <span class="hljs-comment">// &#x8FD4;&#x56DE;true</span>
</code></pre>
<p>&#x590D;&#x5236;&#x4EE3;&#x7801;</p>
<p>instanceof&#xFF0C;&#x9664;&#x4E86;&#x9A8C;&#x8BC1;&#x6570;&#x7EC4;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x9A8C;&#x8BC1;&#x7C7B;&#x578B;&#xFF0C;&#x4F46;&#x6CE8;&#x610F;&#x5B83;&#x8FD4;&#x56DE;&#x7684;&#x4E0D;&#x662F;&#x5177;&#x4F53;&#x7C7B;&#x578B;&#xFF0C;&#x800C;&#x662F;&#x6839;&#x636E;&#x5165;&#x53C2;&#x7684;&#x4E00;&#x4E2A;boolean&#x503C;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> myDate = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>();
<span class="hljs-built_in">console</span>.log(myDate <span class="hljs-keyword">instanceof</span> <span class="hljs-built_in">Date</span>) <span class="hljs-comment">// &#x8FD4;&#x56DE;true</span>

uni.request({
    url: <span class="hljs-string">&apos;https://abc&apos;</span>,
    success: (data) =&gt; {
        <span class="hljs-keyword">if</span> (data.statusCode == <span class="hljs-number">200</span>) {
            <span class="hljs-keyword">const</span> result = data.data as UTSJSONObject
            <span class="hljs-built_in">console</span>.log(result <span class="hljs-keyword">instanceof</span> UTSJSONObject) <span class="hljs-comment">//&#x8FD4;&#x56DE;true</span>
        }
    },
    fail: () =&gt; {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;fail&apos;</span>);
    }
});
</code></pre>
<p>&#x8BE6;&#x89C1;&#xFF1A;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/operator.html#typeof" target="_blank">typeof</a>&#x3001;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/operator.html#instanceof" target="_blank">instanceof</a></p>
<h3 id="&#x5B89;&#x5168;&#x8C03;&#x7528;"><a name="&#x5B89;&#x5168;&#x8C03;&#x7528;" class="plugin-anchor" href="#&#x5B89;&#x5168;&#x8C03;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5B89;&#x5168;&#x8C03;&#x7528;</h3>
<p>js&#x6CA1;&#x6709;&#x7C7B;&#x578B;&#x68C0;&#x67E5;&#x3002;&#x800C;uts&#x548C;ts&#x90FD;&#x6709;&#x4E25;&#x683C;&#x7684;&#x7C7B;&#x578B;&#x68C0;&#x67E5;&#x3002;</p>
<p>&#x5BF9;&#x4E8E;&#x53EF;&#x4E3A;null&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x8C03;&#x7528;&#x65F6;&#x9700;&#x8981;&#x52A0;&#x95EE;&#x53F7;&#xFF0C;&#x5426;&#x5219;&#x7F16;&#x8BD1;&#x5668;&#x4F1A;&#x62A5;&#x9519;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">const</span> s: <span class="hljs-built_in">string</span> | <span class="hljs-literal">null</span> = <span class="hljs-literal">null</span> <span class="hljs-comment">// s&#x4E3A;&#x4E00;&#x4E2A;&#x53EF;&#x4E3A;null&#x7684;&#x5B57;&#x7B26;&#x4E32;</span>
<span class="hljs-built_in">console</span>.log(s?.length) <span class="hljs-comment">//&#x9664;&#x975E;&#x524D;&#x9762;&#x5DF2;&#x7ECF;&#x7ED9;s&#x8D4B;&#x503C;&#xFF0C;&#x5426;&#x5219;&#x8C03;&#x7528;s&#x7684;&#x65B9;&#x6CD5;&#x548C;&#x5C5E;&#x6027;&#x5FC5;&#x987B;&#x52A0;?</span>
</code></pre>
<p>&#x5B89;&#x5168;&#x8C03;&#x7528;&#x6709;&#x5F88;&#x591A;&#x7EC6;&#x8282;&#xFF0C;&#x8BE6;&#x89C1;<a href="https://doc.dcloud.net.cn/uni-app-x/uts/data-type.html#null&#x7C7B;&#x578B;" target="_blank">null&#x7C7B;&#x578B;</a></p>
<h3 id="&#x4EE3;&#x7801;&#x8BED;&#x53E5;&#x7684;&#x5206;&#x5272;"><a name="&#x4EE3;&#x7801;&#x8BED;&#x53E5;&#x7684;&#x5206;&#x5272;" class="plugin-anchor" href="#&#x4EE3;&#x7801;&#x8BED;&#x53E5;&#x7684;&#x5206;&#x5272;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4EE3;&#x7801;&#x8BED;&#x53E5;&#x7684;&#x5206;&#x5272;</h3>
<p>uts&#x7684;&#x591A;&#x4E2A;&#x4EE3;&#x7801;&#x8BED;&#x53E5;&#xFF0C;&#x4EE5;&#x56DE;&#x8F66;&#x6216;&#x5206;&#x53F7;&#x5206;&#x5272;&#x3002;</p>
<p>&#x591A;&#x884C;&#x65F6;&#x884C;&#x5C3E;&#x7684;&#x5206;&#x53F7;&#x53EF;&#x4EE5;&#x7701;&#x7565;&#x3002;&#x5982;&#x679C;&#x5199;&#x5728;&#x4E00;&#x884C;&#xFF0C;&#x5E94;&#x4EE5;&#x5206;&#x53F7;&#x5206;&#x5272;&#x3002;</p>
<p>&#x5982;&#x4E0B;&#x7684;&#x4EE3;&#x7801;&#x90FD;&#x662F;&#x5408;&#x6CD5;&#x7684;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> a:<span class="hljs-built_in">number</span> = <span class="hljs-number">1</span> <span class="hljs-comment">//&#x884C;&#x5C3E;&#x53EF;&#x4EE5;&#x4E0D;&#x52A0;&#x5206;&#x53F7;</span>
<span class="hljs-keyword">let</span> b:<span class="hljs-built_in">boolean</span> = <span class="hljs-literal">false</span>; <span class="hljs-comment">//&#x884C;&#x5C3E;&#x53EF;&#x4EE5;&#x52A0;&#x5206;&#x53F7;</span>
<span class="hljs-keyword">let</span> c:<span class="hljs-built_in">number</span> = <span class="hljs-number">3</span> ; <span class="hljs-keyword">let</span> d:<span class="hljs-built_in">number</span> = <span class="hljs-number">4</span> <span class="hljs-comment">// &#x540C;&#x884C;&#x591A;&#x8BED;&#x53E5;&#x9700;&#x8981;&#x7528;&#x5206;&#x53F7;&#x5206;&#x5272;</span>
</code></pre>
<footer class="page-footer"><span class="copyright">powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2025-05-19 14:09:46
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                </div>
                <script src="https://my.openwrite.cn/js/readmore.js"></script>
                <script>
                    var enablePlugin = false;
                    var allowDomain = "localhost";
                    if(allowDomain){
                        var currentDomain = location.hostname;
                        if ($.isArray(allowDomain)) {
                            $.each(allowDomain, function(index, item) {
                                if (currentDomain == item) {
                                    enablePlugin = true;
                                    return false;
                                }
                            });
                        }else{
                           if (currentDomain == allowDomain) {
                                enablePlugin = true;
                            }
                        }
                    }else{
                        enablePlugin = true;
                    }
                    
                    if(enablePlugin){
                        var isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
                        if (!isMobile) {
                            var btw = new BTWPlugin();
                            btw.init({"allowDomain":"localhost","blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果","id":"vip-container"});
                        }
                    }
                </script> 
          </section>
          
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>
 
          <div class="book-footer">
            
            <div class="donate">
              <div></div>
              <button class="donate-btn" onclick="showModal()">赞赏</button>
            </div>
             
            <div class="copyright"></div>
            
          </div>
          
        </div>
      </div>
      
    </div>

     
    <a
      href="1.uniapp开发鸿蒙应用.html"
      class="
        navigation navigation-prev
        
      "
      aria-label="Previous page: 3.3uniapp开发鸿蒙应用"
    >
      <i class="fa fa-angle-left"></i>
    </a>
     
    <a
      href="4.uniapp for Harmony.html"
      class="
        navigation navigation-next
        
      "
      aria-label="Next page: 3.5uniapp for Harmony"
    >
      <i class="fa fa-angle-right"></i>
    </a>
      
  </div>
  <script>
    function showModal() {
      document.getElementsByClassName("mask")[0].style.display = "block";
      document.getElementsByClassName("donate-modal")[0].style.display =
        "block";
    }
    // 切换赞赏码
    function showDonateImg(num) {
      let alipay = "";
      let wxpay = ""
      if(num){
        wxpay = "hidden"
      }else{
        alipay = "hidden"
      }
      document.getElementById("wxpay-code").hidden = wxpay;
      document.getElementById("alipay-code").hidden = alipay;
      document.getElementsByName("pay-way")[num].checked = "checked";
    }

    // 关闭赞赏框
    function closeDonateModal() {
      document.getElementsByClassName("mask")[0].style.display = "none";
      document.getElementsByClassName("donate-modal")[0].style.display = "none";
    }

    var gitbook = gitbook || [];
    gitbook.push(function () {
      gitbook.page.hasChanged({"page":{"title":"3.4uniapp之uts语言","level":"1.3.4","depth":2,"next":{"title":"3.5uniapp for Harmony","level":"1.3.5","depth":2,"path":"chapter3/4.uniapp for Harmony.md","ref":"./chapter3/4.uniapp for Harmony.md","articles":[]},"previous":{"title":"3.3uniapp开发鸿蒙应用","level":"1.3.3","depth":2,"path":"chapter3/1.uniapp开发鸿蒙应用.md","ref":"./chapter3/1.uniapp开发鸿蒙应用.md","articles":[]},"dir":"ltr"},"config":{"plugins":["github-buttons@2.1.0","edit-link","splitter","tbfed-pagefooter","expandable-chapters","chapter-fold","back-to-top-button","code","pageview-count","popup","search-plus","-lunr","-search","splitter","-sharing","sharing-plus","theme-lou","mind-maps","emphasize","anchors","changyan","readmore","livereload","ace","livereload"],"root":".","styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"expandable-chapters":{}},"emphasize":{},"ace":{},"livereload":{},"splitter":{},"readmore":{"allowDomain":"localhost","blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果"},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"theme-lou":{"hide-elements":[".summary .gitbook-link",".summary .divider"],"color":"#FF4848","book-anchor-title":"本章目录","copyright":{"author":"vx:nut_pie"},"forbidCopy":true,"logo":"assets/avatar.png","book-summary-title":"文章目录","search-placeholder":"输入关键字搜索","copyrightLogo":"assets/copyright.png","favicon":"assets/avatar.png","appleTouchIconPrecomposed152":"assets/avatar.png"},"changyan":{"appid":"cyvHoCPAs","conf":"0440cfc4168ba95d73cfc52dd4d5c60b"},"fontsettings":{"theme":"white","family":"sans","size":2},"mind-maps":{},"highlight":{},"back-to-top-button":{},"pageview-count":{},"github-buttons":{"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"},"sharing":{"qq":false,"all":["qq","qzone","whatsapp","douban","facebook","google","instapaper","linkedin","messenger","twitter","weibo"],"douban":false,"facebook":false,"weibo":false,"twitter":false,"pocket":false,"google":false,"qzone":false},"edit-link":{"label":"编辑此页","base":"https://github.com/ITmxs/gitbook/edit/master/"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"坚果派","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"themeLou":{"nav":[{"target":"_blank","url":"https://www.nutpi.net/","name":"坚果派官网"},{"target":"_blank","url":"https://www.arkui.club/","name":"ArkUI实战"},{"target":"_blank","url":"https://space.bilibili.com/480883651","name":"元服务开发实践"},{"target":"_blank","url":"https://gitcode.com/nutpi","name":"OpenHarmony应用开发"}],"footer":{"donate":{"wechat":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","message":"随意打赏，但不要超过一顿早餐钱 💕","wxpay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","alipay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png","nickname":"breeze","button":"打赏","wechatText":"微信","alipayText":"支付宝","title":"『赠人玫瑰 🌹 手有余香 』","avatar":"http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"},"copyright":true}}},"title":"uniapp/uniapp-x for Harmony教程","language":"zh-hans","gitbook":"*","description":"uniapp/uniapp-x for Harmony电子书教程"},"file":{"path":"chapter3/3.uniapp之uts语言.md","mtime":"2025-05-19T06:09:46.177Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2025-06-30T01:19:14.211Z"},"basePath":"..","book":{"language":""}});
    });
  </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mind-maps/mindmaps.dist.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-changyan/changyan.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/lou.js"></script>
        
    

    </body>
</html>

